package com.theexceptions.todo.view;

import java.util.List;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.theexceptions.todo.controller.ShowMapController;

import android.os.Bundle;

/**
 * An Activity that displays a user's tasks in a MapView. Corresponds to the
 * view: maps.xml.
 * 
 * @author Justian Meyer
 */
public class ShowMapActivity extends MapActivity {
	
	private MapView mapView;
	private LocationItemizedOverlay itemizedOverlay;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.maps);

		mapView = (MapView) findViewById(R.id.mapview);
		mapView.setBuiltInZoomControls(true);

		List<Overlay> mapOverlays = mapView.getOverlays();
		itemizedOverlay = ShowMapController.getCurrentTasksLocationItemizedOverlay(this);
		if (itemizedOverlay != null) mapOverlays.add(itemizedOverlay);
		
		mapView.postInvalidate(); // refresh
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}

}
